package com.hzy.nursing.controller.member;

import com.hzy.common.core.controller.BaseController;
import com.hzy.common.core.domain.R;
import com.hzy.common.core.page.TableDataInfo;
import com.hzy.nursing.domain.NursingProject;
import com.hzy.nursing.service.INursingProjectService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/member/orders")
public class MemberNursingProjectController extends BaseController {

    @Autowired
    private INursingProjectService nursingProjectService;

    @GetMapping("/project/{id}")
    @ApiOperation("根据编号查询护理项目信息")
    public R<NursingProject> getById(@PathVariable("id") Long id) {
        NursingProject nursingProject = nursingProjectService.getById(id);
        return R.ok(nursingProject);
    }

    /**
     * 分页查询护理项目列表
     * (已根据接口文档完善)
     */
    @GetMapping("/project/page")
    @ApiOperation("分页查询护理项目列表")
    public TableDataInfo getByPage(NursingProject nursingProject) {

        startPage();
        List<NursingProject> list = nursingProjectService.selectNursingProjectList(nursingProject);

        return getDataTable(list);
    }
}